<template>
  <div class="app-container">
    <tender-baseInfo ref="tenderBaseInfo"></tender-baseInfo>
    <div style="margin: 10px 0px 10px 80%">
      <el-button type="primary" @click="submit">提交</el-button>
      <el-button type="primary" @click="save">保存</el-button>
      <el-button @click="over">取消</el-button>
    </div>
  </div>
</template>

<script>
import { updateTenderProject, changeTenderProjectStatus } from '@/api/system/purchase';
import BaseInfo from '@/components/tender/baseInfo.vue';
export default {
  components: {
    'tender-baseInfo': BaseInfo,
  },
  data() {
    return {
    }
  },
  mounted() {
  },
  methods: {
    submit() {
      const tenderComment = this.$refs['tenderBaseInfo'];
      const formData = tenderComment.getData();
      changeTenderProjectStatus(formData).then(res => {
        if (res.data == 1) {
          this.$message({
            message: '修改成功',
            type: 'success'
          });
          this.$router.push('/tender/index')
        } else {
          this.$message({
            message: '修改失败',
            type: 'error'
          });
        }
      }).catch(err => {
        this.$message({
          message: '出现了点问题,联系下管理员吧',
          type: 'error'
        });
      });
    },
    save() {
      const tenderComment = this.$refs['tenderBaseInfo'];
      const formData = tenderComment.getData();
      updateTenderProject(formData).then(res => {
        if (res.data == 1) {
          this.$message({
            message: '修改成功',
            type: 'success'
          });
          this.$router.push('/tender/index')
        } else {
          this.$message({
            message: '修改失败',
            type: 'error'
          });
        }
      }).catch(err => {
        this.$message({
          message: '出现了点问题,联系下管理员吧',
          type: 'error'
        });
      })

    },
    over() {

    },
  },
}
</script>
<style lang='scss' scoped></style>